/* 图片处理
 * ImageApi.js
 */

import {REQUEST_URL} from './Constants';
import {postFormData,getData,uploadFiles} from './HttpUtil';

//图片上传
export function uploadImgs(files,category_id){
	return uploadFiles(REQUEST_URL.UPLOAD_IMAGE_URL,files,{category_id:category_id})
	.then(res=>{
		return res;
	},err=>{
		console.log('image api uploadImg error');
		console.log(err);
	});
}

//获取图片列表
export function imglist(params={}){
	return getData(REQUEST_URL.IMAGE_LIST_URL,params)
	.then(res=>{
		return res;
	},err=>{
		console.log('image api imglist error');
		console.log(err);
	});
}

//获取图片类别信息
export function imgCategory(){
	return getData(REQUEST_URL.IMAGE_CATEGORY_URL)
	.then(res=>{
		return res;
	},err=>{
		console.log('image api category error');
		console.log(err);
	});
}